#ifndef PARSER
#define PARSER

typedef struct SwapPacket{
	int type;	//typ packetu
	/*
		type:
		1 - hello
		2 - swap-out request
		3 - swap-out reply
		4 - swap-in request
		5 - swap-in reply
	*/

	short int flag_ack; 	//flagy budu bud 0 alebo 1
	short int flag_nack;

	int checksum;	//checksum 4B
	u32 ip;		//ip adresa
	short int network_load; //vytazenie siete, hodnota 0-255
	short int cpu_load;	//vytazenie cpu, hodnota 0-255
	int num_proc;	//pocet procesov, 4B
	int space; 	//priestor na disku 4B (volny, pozadovany, podla typu packetu)
	u32 page_id;	//identifikator stranky
	struct reqtimer* seq_num; 	//sekvecne cislo (alebo ack cislo, podla typu packetu)
	u32 mem_address; //adresa vo fyzickej pamati

	char data[512];	//swapovana stranka
} SwapPacket;
int analyze(char *raw_data, SwapPacket *x);
int get_int_ip(char *s);
char *get_str_ip(unsigned int ip);

#endif
